using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class apInvbatchheaderMap : EntityTypeConfiguration<apInvbatchheader>
    {
        public apInvbatchheaderMap()
        {
            // Primary Key
            this.HasKey(t => new { t.vendid, t.vendname, t.acct, t.acctname, t.currency, t.batch, t.invno, t.costcenter, t.reference });

            // Properties
            this.Property(t => t.vendid)
                .IsRequired()
                .HasMaxLength(6);

            this.Property(t => t.vendname)
                .IsRequired()
                .HasMaxLength(35);

            this.Property(t => t.acct)
                .IsRequired()
                .HasMaxLength(40);

            this.Property(t => t.acctname)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.currency)
                .IsRequired()
                .HasMaxLength(5);

            this.Property(t => t.batch)
                .IsRequired()
                .HasMaxLength(8);

            this.Property(t => t.invno)
                .IsRequired()
                .HasMaxLength(8);

            this.Property(t => t.costcenter)
                .IsRequired()
                .HasMaxLength(9);

            this.Property(t => t.description)
                .HasMaxLength(40);

            this.Property(t => t.reference)
                .IsRequired()
                .HasMaxLength(6);

            // Table & Column Mappings
            this.ToTable("apInvbatchheader");
            this.Property(t => t.vendid).HasColumnName("vendid");
            this.Property(t => t.vendname).HasColumnName("vendname");
            this.Property(t => t.acct).HasColumnName("acct");
            this.Property(t => t.acctname).HasColumnName("acctname");
            this.Property(t => t.currency).HasColumnName("currency");
            this.Property(t => t.batch).HasColumnName("batch");
            this.Property(t => t.invno).HasColumnName("invno");
            this.Property(t => t.costcenter).HasColumnName("costcenter");
            this.Property(t => t.description).HasColumnName("description");
            this.Property(t => t.date).HasColumnName("date");
            this.Property(t => t.duedate).HasColumnName("duedate");
            this.Property(t => t.amtvend).HasColumnName("amtvend");
            this.Property(t => t.amt).HasColumnName("amt");
            this.Property(t => t.amtdol).HasColumnName("amtdol");
            this.Property(t => t.reference).HasColumnName("reference");
        }
    }
}
